package com.copyurl.notification;

import com.intellij.notification.*;

public class NotificationManage {
    // 获取通知组管理器
    private static final NotificationGroupManager MANAGER = NotificationGroupManager.getInstance();

    // 获取注册的通知组
    private static final NotificationGroup BALLOON = MANAGER.getNotificationGroup("notification.balloon");
    private static final NotificationGroup STICKY_BALLOON = MANAGER.getNotificationGroup("notification.sticky.balloon");
    private static final NotificationGroup TOOL_WINDOW = MANAGER.getNotificationGroup("notification.tool.window");
    private static final NotificationGroup NONE = MANAGER.getNotificationGroup("notification.none");

    public static void successNotification(String message) {
        Notification notification = BALLOON.createNotification(message, NotificationType.INFORMATION);
        Notifications.Bus.notify(notification);
    }

    public static void failNotification(String message) {
        Notification notification = TOOL_WINDOW.createNotification(message, NotificationType.ERROR);
        Notifications.Bus.notify(notification);
    }
}
